<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Style-Type" content="text/css">
  <title></title>
  <meta name="Generator" content="Cocoa HTML Writer">
  <meta name="CocoaVersion" content="824.41">
  <style type="text/css">
    p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
    p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica; min-height: 22.0px}
    p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
    p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
    p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
    p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; min-height: 12.0px}
    p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
    span.s1 {color: #0000bf}
    span.s2 {color: #007300}
    span.Apple-tab-span {white-space:pre}
  </style>
</head>
<body>
<p class="p1">//SLUGens released under the GNU GPL as extensions for SuperCollider 3, by Nick Collins, http://www.informatics.sussex.ac.uk/users/nc81/</p>
<p class="p2"><b></b><br></p>
<p class="p3"><b>DoubleWell3<span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span><span class="Apple-tab-span">	</span>Forced DoubleWell Oscillator</b></p>
<p class="p2"><b></b><br></p>
<p class="p4"><b>DoubleWell2.ar(reset,ratex,ratey,f,w,delta,initx,inity, mul, add)</b></p>
<p class="p5"><br></p>
<p class="p4">Runge-Kutta ODE solver implementation of the chaotic Forced Double Well Oscillator (see Strogatz, Steven H. (1994) Nonlinear Dynamics and Chaos. Addison-Wesley, Reading, MA. pp441-7).<span class="Apple-converted-space"> </span></p>
<p class="p5"><br></p>
<p class="p4">D2x +delta*Dx-x+x^3 = F</p>
<p class="p5"><br></p>
<p class="p4">y = Dx</p>
<p class="p5"><br></p>
<p class="p4">All inputs can have .kr rate UGens plugged in. F is itself an arbitrary audio rate UGen input forcing term</p>
<p class="p5"><br></p>
<p class="p4"><b>reset</b>- restart with new initial conditions sampled from initx, inity</p>
<p class="p4"><b>rate</b>- update rate for x and y</p>
<p class="p4"><b>f-</b> forcing term, an arbitrary audio rate input</p>
<p class="p4"><b>delta</b>- equation constant</p>
<p class="p4"><b>initx</b>- reset value for x</p>
<p class="p4"><b>inity</b>- reset value for y</p>
<p class="p5"><br></p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p1">//bass synth</p>
<p class="p7">{<span class="s1">Out</span>.ar(0,<span class="s1">Pan2</span>.ar(<span class="s1">DoubleWell3</span>.ar(f:<span class="s1">SinOsc</span>.ar(<span class="s1">MouseX</span>.kr(0,200),0,<span class="s1">MouseY</span>.kr(0.5,4.0))),0.0))}.play</p>
<p class="p6"><br></p>
<p class="p1">//plotting check of first samples</p>
<p class="p7">{<span class="s1">DoubleWell3</span>.ar}.plot(0.05, minval:-1, maxval:1)</p>
<p class="p6"><br></p>
<p class="p1">//gradually changing<span class="Apple-converted-space"> </span></p>
<p class="p7">{<span class="s1">Pan2</span>.ar(<span class="s1">DoubleWell3</span>.ar(0,0.05,<span class="s1">LFSaw</span>.ar(<span class="s1">Line</span>.kr(10,1000,10)),<span class="s1">Line</span>.kr(0.0,0.3,20)),0.0)}.play</p>
<p class="p6"><br></p>
<p class="p1">//controlled - midscreen amplitude jump</p>
<p class="p7">{<span class="s1">Pan2</span>.ar(<span class="s1">DoubleWell3</span>.ar(0,0.05,<span class="s1">LFSaw</span>.ar(<span class="s1">MouseX</span>.kr(10,1000)),<span class="s1">MouseY</span>.kr(0.0,0.5)),0.0)}.play</p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p1">//triggering</p>
<p class="p7">{<span class="s1">DoubleWell3</span>.ar(<span class="s1">Impulse</span>.kr(<span class="s1">MouseY</span>.kr(0.01,100, <span class="s2">'exponential'</span>)),0.1,<span class="s1">LFCub</span>.ar(<span class="s1">MouseX</span>.kr(10,1000, <span class="s2">'exponential'</span>)),<span class="s1">MouseY</span>.kr(0.0,1.0),<span class="s1">LFNoise0</span>.kr(2.3,0.2,0.8),<span class="s1">LFNoise1</span>.kr(2.37,0.2,0.8))}.play</p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p1">//AudioIn as forcing</p>
<p class="p7">{<span class="s1">Pan2</span>.ar(<span class="s1">DoubleWell3</span>.ar(0,0.05,<span class="s1">LPF</span>.ar(<span class="s1">AudioIn</span>.ar(1),100,<span class="s1">MouseX</span>.kr(0,1000)),<span class="s1">MouseY</span>.kr(0.0,0.5)),0.0)}.play</p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p6"><br></p>
<p class="p6"><br></p>
</body>
</html>
